O’Hara on GitHub


1 Summary

Read in taxonomic traits filled in by taxon experts and cleaned in prior scripts. Combine with coded sensitivity, adaptive capacity, and exposure from stressor-trait sheets to calculate vulnerability.

2 Data

_raw_data/xlsx/master_all_taxa_trait_data.xlsx is the raw workbook prepared by Nathalie Butt from the various submissions of the taxa-group experts. This has been processed and cleaned to _data/spp_traits_valid.csv. See earlier scripts in the process.

trait_stressor_rankings/final_scores_all_stressors_traits.xlsx is a workbook with each sheet indicating sensitivity or adaptive capacity; columns in each sheet indicate stressors, and rows indicate traits.

3 Methods

3.1 Use scored sensitivity traits to stressors against species scored to traits

Set up a function to consistently clean trait values. Trait values in the species trait file are already cleaned and adjusted in many cases to get around mismatches; they are generally lower case, no punctuation except for greater/less than signs.

This function also cleans up category and trait names for consistency. All lower case, punctuation and spaces replaced with underscores. The species trait file is already cleaned in this manner.

clean_traitnames <- function(df, overwrite_clean_col = FALSE) {
  df <- df %>% 
    mutate(category = str_replace_all(category, '[^A-Za-z0-9]+', '_') %>% tolower(),
           category = str_replace_all(category, '^_|_$', ''),
           trait    = str_replace_all(trait, '[^A-Za-z0-9]+', '_') %>% tolower(),
           trait    = str_replace_all(trait, '^_|_$', ''))
  if(!overwrite_clean_col & ('trait_value' %in% names(df))) {
      return(df) ### without overwriting existing trait_value
  }
  if(overwrite_clean_col & ('trait_value' %in% names(df))) {
    x <- readline(prompt = 'Overwriting existing trait_value column? y/n ')
    if(str_detect(x, '^n')) stop('dammit!')
  }
  ### overwrite existing, or add new
  df <- df %>%
    mutate(trait_value = str_replace_all(tolower(trait_value), '[^0-9a-z<>]', ''))
  
  return(df)
}

clean_traitvals <- function(df) {
  x <- df$trait_value
  ### First: remove numeric commas
  y <- str_replace_all(x, '(?<=[0-9]),(?=[0-9])', '') %>%
    ### then: drop all non-alphanumeric and a few key punctuation:
    str_replace_all('[^0-9a-zA-Z<>,;\\-\\.\\(\\)/ ]', '') %>% 
    ### lower case; do it after dropping any weird non-ascii characters:
    tolower() %>% 
    str_trim() %>%
    str_replace_all('n/a', 'na') %>%
    ### convert remaining commas and slashes to semicolons:
    str_replace_all('[,/]', ';') %>%
    ### drop spaces after numbers e.g. 3 mm -> 3mm:
    str_replace_all('(?<=[0-9]) ', '') %>%
    ### drop spaces before or after punctuation (non-alphanumeric):
    str_replace_all(' (?=[^a-z0-9\\(])|(?<=[^a-z0-9\\)]) ', '') %>%
    ### manually fix some valid slashes:
    str_replace_all('nearly sessile;sedentary', 'nearly sessile/sedentary') %>%
    str_replace_all('live birth;egg care', 'live birth/egg care') %>%
    str_replace_all('chitin;caco3mix', 'chitin/caco3 mix') %>%
    str_replace_all('0.5-49mm', '0.5mm-49mm')
    
  df$trait_value <- y
  return(df)
}

assign_rank_scores <- function(x) {
  y <- tolower(as.character(x))
  z <- case_when(!is.na(as.numeric(x)) ~ as.numeric(x),
                 str_detect(y, '^na')  ~ NA_real_,
                 str_detect(y, '^n')   ~ 0.00, ### none, NA, no
                 str_detect(y, '^lo')  ~ 0.33,
                 str_detect(y, '^med') ~ 0.67,
                 str_detect(y, '^hi')  ~ 1.00,
                 str_detect(y, '^y')   ~ 1.00, ### yes
                 TRUE                  ~ NA_real_) ### basically NA
  return(z)
}

Since the species trait file is already cleaned, DO NOT use the clean_traitvals function - it will overwrite the trait_value column.

3.1.1 Check matching

Unmatched traits between sensitivity scoring sheets and species trait sheets:

These traits are in the species-trait scoring sheets but not found in the sensitivity trait scores (should be adaptive capacity/exposure traits only):

navigation_requirements_sound_or_light_or_magnetic, number_of_sites, number_of_sites_incl_terrestrial_wetlands, adult_mobility, planktonic_larval_duration_pld_exposure, age_to_1st_reproduction_generation_time, are_there_sub_populations, can_the_sex_ratio_be_altered_by_a_stressor, fecundity, global_population_size, lifetime_reproductive_opportunities, max_age, parental_investment, post_birth_hatching_parental_dependence, reproductive_strategy, depth_min_max, eoo_range, zone, if_one_few_size, sub_population_dependence_on_particular_sites

These traits are in the trait-sensitivity scoring sheet but not found in the species scoring (need to be scored for species):

navigation_requirements_sound, navigation_requirements_light, navigation_requirements_magnetic

3.1.3 Sensitivity to top three stressors by taxon

3.2 Score general adaptive capacity

General adaptive capacity traits are basically related to the overall population’s resilience in the face of a threat. Large extents of occurrence, large population sizes, presence of multiple subpopulations, and reproductive strategies fall into this category.

3.2.1 Check matching

Unmatched traits between general adaptive capacity scoring sheet and species trait sheets:

Traits in species-trait sheets not in general adcap scores: adult_body_mass_body_size, biomineral, calcium_carbonate_structure_location, calcium_carbonate_structure_stages, communication_requirement_sound, extreme_pressure_wave_sensitive_structures, flight, navigation_requirements_sound_or_light_or_magnetic, respiration_structures, adult_mobility, planktonic_larval_duration_pld_exposure, dissolved_oxygen, ph, salinity, sensitivity_to_wave_energy_physical_forcing, thermal_sensitivity_to_heat_spikes_heat_waves, thermal_sensitivity_to_ocean_warming_max_temps_tolerated, can_the_sex_ratio_be_altered_by_a_stressor, feeding_larva_post_hatching_metamorphosis, depth_min_max, zone, across_stage_dependent_habitats_condition, air_sea_interface, dependent_interspecific_interactions, extreme_diet_specialization, light_dependence, terrestrial_and_marine_life_stages, within_stage_dependent_habitats_condition, if_one_few_size

Traits in general adcap scores but not in spp traits:

  • Median: 6.67
  • Mean: 6.4890888
  • Standard Deviation: 2.262208

3.3 Score specific adaptive capacity

Specific adaptive capacity traits are basically related to an organism’s ability to avoid or mitigate exposure, primarily through movement and larval dispersal.

3.3.1 Check matching

Unmatched traits between specific adaptive capacity scoring sheet and species trait sheets:

Traits in species-trait sheets, not in specific adaptive capacity scores:

adult_body_mass_body_size, biomineral, calcium_carbonate_structure_location, calcium_carbonate_structure_stages, communication_requirement_sound, extreme_pressure_wave_sensitive_structures, flight, navigation_requirements_sound_or_light_or_magnetic, respiration_structures, number_of_sites, number_of_sites_incl_terrestrial_wetlands, dissolved_oxygen, ph, salinity, sensitivity_to_wave_energy_physical_forcing, thermal_sensitivity_to_heat_spikes_heat_waves, thermal_sensitivity_to_ocean_warming_max_temps_tolerated, age_to_1st_reproduction_generation_time, are_there_sub_populations, can_the_sex_ratio_be_altered_by_a_stressor, fecundity, feeding_larva_post_hatching_metamorphosis, global_population_size, lifetime_reproductive_opportunities, max_age, parental_investment, post_birth_hatching_parental_dependence, reproductive_strategy, eoo_range, across_stage_dependent_habitats_condition, air_sea_interface, dependent_interspecific_interactions, extreme_diet_specialization, light_dependence, terrestrial_and_marine_life_stages, within_stage_dependent_habitats_condition, if_one_few_size, sub_population_dependence_on_particular_sites

Traits in specific ad cap scores, not in spp-traits:

3.3.2 specific adaptive capacity by stressor and species group

stressor median mean sd
air_temp 1.00 1.093294 0.5075303
biomass_removal 3.00 2.793224 1.1457527
disease_pathogens 3.00 2.814252 1.1765079
entanglement 3.67 3.316589 1.0171061
eutrophication_nutrient_pollution 3.34 3.201110 0.9484584
habitat_loss_degradation 4.00 3.684579 1.2894382
inorganic_pollution 2.67 2.878213 0.9648519
invasive_species 3.00 2.591121 1.0959215
light_pollution 3.00 3.390958 1.1581352
noise_pollution 3.67 3.526565 1.2997845
oa 3.67 3.731787 1.2930291
oceanographic 3.00 2.955911 1.2822757
organic_pollution 2.67 2.878213 0.9648519
plastic_pollution 3.00 3.017979 1.2279242
poisons_toxins 3.00 2.917921 0.9447646
salinity 3.34 3.241133 1.0418816
sedimentation 3.00 2.917535 0.9454804
slr 2.00 1.759346 0.9914401
storm_disturbance 3.67 3.475608 1.2016683
uv 2.00 2.109474 1.3459320
water_temp 3.33 3.033481 1.1064766
wildlife_strike 2.67 2.414416 1.3781779

3.3.3 Adaptive capacity to top three stressors by taxon

3.4 Assign exposure potential modifier

Exposure potential modifier checks whether the depth and oceanic zones of the stressor match with the depth and oceanic zones of the species. These fall into the “spatial scale” category with the exception of EOO.

3.4.1 These species are not listed as potential exposure to these stressors:

Note: this is exposure potential only, based on overlap between species presence and stressor presence - nothing about sensitivity or actual exposure. Check that these logic out.

3.4.2 These species drop out of the exposure potential calculation

Check the spp traits for these species to identify proper assignment of at least one depth zone or ocean zone.

3.5 Determine habitats for habitat loss/degradation stressor

Habitat loss and degradation can be considered as an exposure variable, in the same way as potential exposure above. However, in this case, we consider only one stressor.

Questions to consider that will affect scoring/weighting:

3.5.1 Is there an actionable difference between across-stage and within-stage dependence?

  • Multiple habitats in the “within-stage” category seems to suggest that a species can move among habitats therefore being less sensitive to degradation of one habitat in its range. This is a “parallel habitats” interpretation.
    • However, some species may depend on various habitats in a “series habitat” interpretation, e.g., birds that depend on one habitat type for nesting/breeding, another type for forage, and a third for stopovers in migration. In this case, harm to any would present a bottleneck.
  • Multiple habitats in the “across-stage” category seem to indicate a “series” interpretation - e.g., a fish species whose larvae grow in mangroves, then adults move to reefs.
    • However, stages could survive in multiple habitats (e.g., parallel).
  • Because the trait category is not well defined, we cannot systematically distinguish between series and parallel interpretations for either across- or within-stage dependence.
  • A series interpretation would sum the vulnerabilities; a parallel interpretation would take an average. Which is most conservative? Parallel would communicate the less alarming results, and has the advantage that it also avoids overweighting based on the number of habitats scored.

To score this we will simply lump together all unique listed habitats, regardless of within- or across-stage. This simplifies things so we can simply calculate the habitat degradation vulnerability as normal, and append the habitat name onto the hab loss/degradation stressor name…

4 Combine scores

We will try a calculation for vulnerability \(V\) of species \(i\) to stressor \(j\) that basically looks like this:

\[\text{sensitivity score } S_{i,j} = \mathbf{s}_j^T \mathbf{t}_i\] based on a vector \(\mathbf{s}_j\) of trait-based sensitivity to stressor \(j\), and vector \(\mathbf{t}_i\) of traits of species \(i\);

\[\text{specific adaptive capacity score } K_{i,j} = \mathbf{k}_j^T \mathbf{t}_i\] based on vector \(\mathbf{k}_j\) of trait-based specific adaptive capacity to stressor \(j\); \[\text{general adaptive capacity score } G_{i} = \mathbf{g}^T \mathbf{t}_i\] based on vector \(\mathbf{g}\) of trait-based general adaptive capacity;

\[\text{exposure potential modifier } E_{i,j} = \begin{cases} 1 \text{ when }\mathbf{e}_j^T \mathbf{t}_i > 0\\ 0 \text{ else} \end{cases}\] based on vector \(\mathbf{e}_j\) of trait-based presence of stressor \(j\) (i.e. depth zones and ocean zones in which stressor occurs).

\[\text{vulnerability } V_{i,j} = \frac{S_{i,j} / {S_j}'}{1 + G_i/ {G}' + K_{i,j}/ {K_j}'} \times E_{i,j}\] Each component (\(S_{i,j}, G_i, K_{i,j}\)) is normalized by a reference value (\(S_{j}', G', K_{j}'\) using mean, median, max, etc) for that component for that stressor across all species. Note: median risks referencing to zero for some stressors with few sensitivities (e.g. light pollution); mean risks having a very low reference for the same. Max risks being driven by an outlier, but here the sensitivity scores are generally capped at some low-ish value since there are a finite number of traits that can confer sensitivity. Therefore, we will use max as the reference point. We may wish to consider max possible, which may differ from max observed, in a future iteration?

For species groups with NA in specific adaptive capacity, force to zero (no matching adaptive traits); for species with NA in exposure potential, force to 1 (assume exposure potential).

These results will be saved by species group for now, for future matching to the species level.

4.0.2 Vulnerability to top three stressors by taxon

taxon stressor vuln
cephalopods oceanographic 0.4287602
cephalopods inorganic_pollution 0.3981745
cephalopods organic_pollution 0.3852865
corals oceanographic 0.5613899
corals light_pollution 0.5558158
corals eutrophication_nutrient_pollution 0.5066372
corals salinity 0.5066372
crustacea_arthropods plastic_pollution 0.4042787
crustacea_arthropods biomass_removal 0.3439497
crustacea_arthropods organic_pollution 0.2728975
echinoderms oceanographic 0.5545884
echinoderms eutrophication_nutrient_pollution 0.4593520
echinoderms water_temp 0.4460112
elasmobranchs plastic_pollution 0.4453328
elasmobranchs biomass_removal 0.3582953
elasmobranchs oceanographic 0.3375519
fish inorganic_pollution 0.3414891
fish salinity 0.3405274
fish plastic_pollution 0.3287240
marine_mammals biomass_removal 0.5809734
marine_mammals entanglement 0.5612193
marine_mammals wildlife_strike 0.5257645
molluscs plastic_pollution 0.3731084
molluscs eutrophication_nutrient_pollution 0.3702417
molluscs oa 0.3677699
plants_algae light_pollution 0.4891184
plants_algae biomass_removal 0.3299392
plants_algae organic_pollution 0.3283583
polychaetes plastic_pollution 0.1696128
polychaetes poisons_toxins 0.0867910
polychaetes sedimentation 0.0867910
reptiles biomass_removal 0.5325276
reptiles invasive_species 0.4851675
reptiles entanglement 0.4673918
seabirds invasive_species 0.4349899
seabirds biomass_removal 0.4271460
seabirds uv 0.3712182
sponges organic_pollution 0.2140092
sponges noise_pollution 0.2063414
sponges inorganic_pollution 0.1579990

5 TO DO

  • fix navigation requirements (light, sound, magnetic) into separate rows where appropriate
    • e.g. cetaceans navigate by sound; birds/turtles/sharks maybe by magnetic; turtles by light?
    • this has to be done on the species trait sheet level.
  • get traits for more species
    • where are the rest of the corals?
    • more fish?
    • extract some values from FishBase and SealifeBase perhaps
    • note these can be gapfilled but more info at spp level = better